





/*
void VideoRecorder::startRecording()
{
    // Step 1: Open the default camera (usually the built-in webcam)
    if (!videoCapture.open(0))
    {
        std::cerr << "Error opening the camera" << std::endl;
        return;
    }

    // Step 2: Get the camera properties (e.g., frame width, frame height, and frames per second)
    int frameWidth = static_cast<int>(videoCapture.get(cv::CAP_PROP_FRAME_WIDTH));
    int frameHeight = static_cast<int>(videoCapture.get(cv::CAP_PROP_FRAME_HEIGHT));
    double fps = videoCapture.get(cv::CAP_PROP_FPS);

    // Step 3: Create a VideoWriter object to save the recorded video
    std::string videoFilename = "output.avi";
    int codec = cv::VideoWriter::fourcc('M', 'J', 'P', 'G'); // Define the codec for the output video
    videoWriter.open(videoFilename, codec, fps, cv::Size(frameWidth, frameHeight));

    if (!videoWriter.isOpened())
    {
        std::cerr << "Error opening the video writer" << std::endl;
        videoCapture.release();
        return;
    }

    isRecording = true;

    // Step 4: Capture and save video frames in a loop
    cv::Mat frame;
    while (isRecording)
    {
        if (!videoCapture.read(frame))
        {
            std::cerr << "Error reading frame from camera" << std::endl;
            break;
        }

        videoWriter.write(frame);
    }
}

void VideoRecorder::stopRecording()
{
    // Step 5: Stop the recording loop by setting isRecording to false
    isRecording = false;

    // Step 6: Release the VideoWriter and VideoCapture objects
    videoWriter.release();
    videoCapture.release();
}

void VideoRecorder::recordingFinished()
{
    // Handle recording finished event
    // This can be used to perform any necessary cleanup or post-processing tasks
}
*/